<?php
	echo "<div id='paginaprincipal'>";

	if ((empty($cmsconfiguration['Cmsconfiguration']['visible_msg_perfil']))) {
		echo "<div><p>A ONG e/ou Entidade Filantrópica não disponibilizou nenhuma informação para essa página até o momento.</p></div>";
	}

	/*Msg de Boas Vindas*/
	if($cmsconfiguration['Cmsconfiguration']['visible_msg_perfil']==true && (!empty($web['Web']['msg_perfil']))) {
		echo "<div id='welcome' style='border:1px #FFFFFF solid;'>";
		echo "<span>".$web['Web']['msg_perfil']."</span>";
		echo "</div>";
	}
	
	/* Album */	
	if($cmsconfiguration['Cmsconfiguration']['visible_album']==true && (!empty($albums))){
		echo "<div class='homebox'>";
			
			echo "<h4>Últimas fotos</h4>";
			echo "<ul  class='item_front'>";
			
			foreach ($albums as $album) {
				echo "<span>".$html->link($album['Album']['titulo'].' ('.date_format(date_create($album['Album']['data']),'d/m/Y').')',$album['Album']['link'], array('class'=>'link'))."<span>";
				echo '<br>'; 
			}
			echo "</ul>";

			echo "<span class='mais'><a class='link' href='".Router::url("/site/".$organization['Organization']['alias']."/album/", true)."'>Veja mais fotos..</a></span>";
		
		echo "</div>";
	}
	
	/* Eventos */
	if($cmsconfiguration['Cmsconfiguration']['visible_event']==true && (!empty($events))) {
		echo "<div class='homebox'>";
			echo "<h4>Próximos eventos</h4>";
			echo "<ul  class='item_front'>";
			foreach ($events as $event) {
				echo "<li><span class='date_item'>".date("d/m/Y",strtotime($event['Event']['date']))."</span> - <a class='link_evento item_front' href='".$event['Event']['link']."'>".$event['Event']['title']." - <b>mais informações</b></a></li>";
			}
			echo "</ul>";
			echo "<span class='mais'><a class='link' href='".Router::url("/site/".$organization['Organization']['alias']."/eventos/", true)."'>Veja mais eventos..</a></span>";
		echo "</div>";
	}
	
	//echo "<div style='border:1px #0FFFFF solid;width:48%; float:right; right:0px;'>";
	/* Noticias */
	if($cmsconfiguration['Cmsconfiguration']['visible_news']==true && (!empty($noticias))) {
		echo "<div class='homebox'>";
			echo "<h4>Últimas notícias..</h4>";
			echo "<ul>";
			foreach ($noticias as $noticia) {
				echo "<li><span class='date_item'>".date("d/m/Y",strtotime($noticia['Noticia']['publishedon']))."</span> - <a class='link_noticia' href='".$noticia['Noticia']['link']."'>".$noticia['Noticia']['title']." &nbsp;-&nbsp;<b>leia mais</b></a></li>";
			}
			echo "</ul>";
						echo "<span class='mais'><a class='link' href='".Router::url("/site/".$organization['Organization']['alias']."/noticias/", true)."'>Veja mais notícias..</a></span>";
		echo "</div>";
	}
	
	/* Video */
	if($cmsconfiguration['Cmsconfiguration']['visible_video']==true && (!empty($last_video))) {
		$thumbnail = $last_video['thumbnail'];
		$title = $last_video['name'];
		
		$video_link = "/site/".$organization['Organization']['alias']."/videos/".$last_video['id'];
		$video_link = Router::url($video_link, true);
		echo "<div class='homebox'>";
			echo "<h4>Último vídeo adicionado.</h4>";
			echo "<div>";
			
			
			echo "<a id='yt_thumbnail' href='".$video_link."' >";
				echo "<div id='yt_thumbnail_ext'>";
					echo "<div id='yt_thumbnail'>";
						echo "<img id='yt_thumbnail' src='../../img/i_play.gif' style=\"background-image: url(".$thumbnail.");\" '/>";
					echo "</div>";
					echo "<div id='corner_text'>";
						echo "<span id='duration'>".$duration."</span>";
					echo "</div>";
				echo "</div>";
			echo "</a>";
			echo "<span>".$title."</span>";
			echo "<span class='mais'><a class='link' href='".Router::url("/site/".$organization['Organization']['alias']."/videos/", true)."'>Veja mais vídeos..</a></span>";
		echo "</div>";
	}
echo "</div>";


